﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Defect_Tracking_System.Models.DefectListModel>" %>
<table border="0" width="100%" cellpadding="0" cellspacing="0" class="product-table">
<tr>
	<th class="table-header-check"></th>
	<th class="table-header-repeat line-left minwidth-1"><a href="#">Number</a>	</th>
	<th class="table-header-repeat line-left minwidth-1"><a href="#">Title</a></th>
	<th class="table-header-repeat line-left"><a href="#">Type</a></th>
    <th class="table-header-repeat line-left"><a href="#">Project</a></th>
	<th class="table-header-repeat line-left"><a href="#">Priority</a></th>
	<th class="table-header-repeat line-left"><a href="#">Status</a></th>
	<th class="table-header-repeat line-left"><a href="#">Created</a></th>
	<th class="table-header-repeat line-left"><a href="#">Creator</a></th>
	<th class="table-header-repeat line-left"><a href="#">Assigned</a></th>                   
	<th class="table-header-options line-left"><a href="#">Options</a></th>
</tr>
<% foreach(Defect_Tracking_System.Models.DefectModel defect in Model.Defects){ %>
<tr id="<%: defect.DefectId %>">
	<td><input  type="checkbox" name="defectId" value="<%: defect.DefectId %>"/></td>
	<td><a href="" class=""><%: defect.DefectNumber%></a></td>
	<td><%: defect.DefectTitle%></td>
	<td><%: defect.Type%></td>
    <td><%: defect.ProjectName %></td>
	<td><%: defect.Priority%></td>
	<td><%: defect.Status%></td>
	<td><%: defect.CreatedDate %></td>
	<td><%: defect.Creator%></td>
	<td><%: defect.AssignedMember %></td>
	<td class="options-width">
        <% if (Model.UserName == defect.AssignedMember || Page.User.IsInRole("Group Admin") || Page.User.IsInRole("Project Admin"))
           { %>
                <a href="/Defect/Resolution/<%: defect.DefectId %>?ReturnUrl=<%= Request.Url.ToString() %>" title="Edit Solution" class="icon-Solution info-tooltip"></a>
        <% } %>
        <% if (Model.UserRole != "User" || (Model.UserRole == "User" && (Model.UserName == defect.Creator || Model.UserName == defect.AssignedMember)))
            {
                if (!defect.IsClose)
                {%>
                <a href="/Defect/CloseReopenDefect?id=<%: defect.DefectId %>&act=Close&requesturl=<%: Request.Url.ToString() %>" class="icon-close info-tooltip" title="Close this defect"></a>
            <% }
                else
                { %>
                <a href="/Defect/CloseReopenDefect?id=<%: defect.DefectId %>&act=ReOpen&requesturl=<%: Request.Url.ToString() %>" class="icon-open info-tooltip" title="Re-Open this defect"></a>
            <% }
            } %>
            <a href="/Defect/Details/<%: defect.DefectId %>" title="View" class="icon-6 info-tooltip"></a>
        <% if (Model.UserRole != "User" || Model.UserName == defect.Creator || (defect.AssignedMember == Model.UserName))
            { %>
				<a href="/Defect/Edit/<%: defect.DefectId %>?ReturnUrl=<%= Request.Url.ToString() %>" title="Edit" class="icon-1 info-tooltip"></a>
        <% } %>
        <% if (Model.UserRole != "User" || Model.UserName == defect.Creator)
            { %>
                <a href="/Defect/DeleteDefect/<%: defect.DefectId %>/<%: Model.PageIndex %>/<%: Model.Type %>" onclick="return confirm('Are you sure to delete this defect?')" title="Delete" class="icon-2 info-tooltip"></a>
        <% } %>
	</td>
</tr>
<% } %>
</table>

	<!--  end product-table................................... --> 
